package com.lmiot.xyclick.Util;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Environment;
import android.support.v4.internal.view.SupportMenu;
import android.text.Editable;
import android.text.Html;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.NumberPicker;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.lkx.liandianqinew.R;
import com.lmiot.xyclick.Activity.MainActivity;
import com.lmiot.xyclick.Activity.PayVIPActivity;
import com.lmiot.xyclick.Activity.SortAutoListActivity;
import com.lmiot.xyclick.App.MyApp;
import com.lmiot.xyclick.Auto.AutoUtils;
import com.lmiot.xyclick.Bean.DelayEndTime;
import com.lmiot.xyclick.Bean.DoAutoBean;
import com.lmiot.xyclick.Bean.FinishFloatActivityBean;
import com.lmiot.xyclick.Bean.InitFloatBean;
import com.lmiot.xyclick.Bean.SQL.ActionBeanSqlUtil;
import com.lmiot.xyclick.Bean.SQL.AutoBean;
import com.lmiot.xyclick.Bean.SQL.AutoBeanSqlUtil;
import com.lmiot.xyclick.View.TextConfigNumberPicker;
import com.xiaoyi.intentsdklibrary.SDK.Action.ActionAsSDK;
import com.xiaoyi.intentsdklibrary.SDK.Action.ActionNormalSDK;
import com.youyi.yychosesdk.SDK.YYChoseSDK;
import com.youyi.yychosesdk.models.album.entity.Photo;
import com.youyi.yycutsdklibrary.SDK.YYCutSDK;
import com.youyi.yypermissionlibrary.SDK.YYPerUtils;
import com.youyi.yyviewsdklibrary.Dialog.util.ToastUtil;
import com.youyi.yyviewsdklibrary.View.roundedimageview.RoundedImageView;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.greenrobot.eventbus.EventBus;

public class LayoutDialogUtil {
    private static final String TAG = "LayoutDialogUtil";
    private static Dialog dialog;
    private static DialogAutoAdapter dialogAutoAdapter;
    private static Intent intent;
    private static int mHours_01;
    private static int mMinute_01;
    private static String mSearchName;
    private static int mSecond_01;

    static String[] typeList01 = {"0", "1","2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59"};
    static String[] typeList02 = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"};

    public interface OnResultClickListener {
        void result(boolean z);
    }

    public static Dialog createDailog(Context context, int i) {
        Dialog dialog2 = new Dialog(context);
        try {
            dialog2.requestWindowFeature(1);
            dialog2.setContentView(i);
            Window window = dialog2.getWindow();
            window.setSoftInputMode(1);
            window.setBackgroundDrawableResource(R.drawable.dialog_bg);
            WindowManager.LayoutParams attributes = window.getAttributes();
            window.setGravity(17);
            attributes.width = -2;
            attributes.height = -2;
            window.setAttributes(attributes);
            dialog2.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dialog2;
    }

    public static Dialog createSysDailog(Context context, int i) {
        Dialog dialog2 = new Dialog(context);
        if (!YYPerUtils.hasOp()) {
            ActionNormalSDK.getInstance().gotoFloatPermissionSetting(context);
        }
        try {
            dialog2.requestWindowFeature(1);
            dialog2.setContentView(i);
            Window window = dialog2.getWindow();
            window.setSoftInputMode(1);
            window.setBackgroundDrawableResource(R.drawable.dialog_bg);
            WindowManager.LayoutParams attributes = window.getAttributes();
            window.setGravity(17);
            if (Build.VERSION.SDK_INT >= 26) {
                window.setType(2038);
            } else {
                window.setType(2003);
            }
            attributes.width = -2;
            attributes.height = -2;
            window.setAttributes(attributes);
            dialog2.show();
        } catch (Exception e) {
            e.printStackTrace();
            ActionNormalSDK.getInstance().gotoFloatPermissionSetting(context);
        }
        return dialog2;
    }

    public static Dialog createBottomDailog(Context context, int i) {
        Dialog dialog2 = new Dialog(context, R.style.ViewActionSheetDialogStyle);
        if ((context instanceof MyApp) && !YYPerUtils.hasOp()) {
            ActionNormalSDK.getInstance().gotoFloatPermissionSetting(context);
        }
        try {
            dialog2.requestWindowFeature(1);
            dialog2.setContentView(i);
            Window window = dialog2.getWindow();
            window.setSoftInputMode(1);
            WindowManager.LayoutParams attributes = window.getAttributes();
            window.setGravity(80);
            if (context instanceof MyApp) {
                if (Build.VERSION.SDK_INT >= 26) {
                    window.setType(2038);
                } else {
                    window.setType(2003);
                }
            }
            attributes.width = -1;
            attributes.height = -2;
            window.setAttributes(attributes);
            dialog2.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dialog2;
    }

    public static void shwoTip(Context context, final OnResultClickListener onResultClickListener) {
        try {
            Dialog dialog2 = dialog;
            if (dialog2 != null && dialog2.isShowing()) {
                dialog.dismiss();
            }
            if (context instanceof MyApp) {
                dialog = createSysDailog(context, R.layout.dgg_tip_agreement);
            } else {
                dialog = createDailog(context, R.layout.dgg_tip_agreement);
            }
            dialog.setCancelable(false);
            ((TextView) dialog.findViewById(R.id.tv_cancel)).setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    LayoutDialogUtil.dialog.dismiss();
                    if (onResultClickListener != null) {
                        onResultClickListener.result(false);
                    }
                }
            });
            ((TextView) dialog.findViewById(R.id.tv_sure)).setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    LayoutDialogUtil.dialog.dismiss();
                    if (onResultClickListener != null) {
                        onResultClickListener.result(true);
                    }
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static Dialog createBottomDailogNew(Context context, int i) {
        Dialog dialog2 = new Dialog(context, R.style.ViewActionSheetDialogStyle);
        if ((context instanceof MyApp) && !YYPerUtils.hasOp()) {
            ActionNormalSDK.getInstance().gotoFloatPermissionSetting(context);
        }
        try {
            dialog2.requestWindowFeature(1);
            dialog2.setContentView(i);
            Window window = dialog2.getWindow();
            window.setSoftInputMode(1);
            WindowManager.LayoutParams attributes = window.getAttributes();
            window.setGravity(80);
            if (context instanceof MyApp) {
                if (Build.VERSION.SDK_INT >= 26) {
                    window.setType(2038);
                } else {
                    window.setType(2003);
                }
            }
            attributes.width = -1;
            attributes.height = -1;
            window.setAttributes(attributes);
            dialog2.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dialog2;
    }

    public static void showSureDialog(final Context context, String str, String str2, boolean z, boolean z2, String str3, String str4, final OnResultClickListener onResultClickListener) {

//        try {
            Dialog dialog2 = null;
//            Dialog dialog2 = dialog;
//            if (dialog2 != null && dialog2.isShowing()) {
//                dialog.dismiss();
//            }
            if (context instanceof MyApp) {
                dialog = createSysDailog(context, R.layout.dialog_xy_sure);
            } else {
                dialog = createDailog(context, R.layout.dialog_xy_sure);
            }
            dialog.setCancelable(false);
            TextView textView = (TextView) dialog.findViewById(R.id.id_content);
            TextView textView2 = (TextView) dialog.findViewById(R.id.tv_cancel);
            TextView textView3 = (TextView) dialog.findViewById(R.id.tv_sure);
            ((TextView) dialog.findViewById(R.id.tv_title)).setText(str);
            textView.setText(str2);
            if (z) {
                textView.setTextColor(-65536);
            }
            if (z2) {
                textView.setGravity(17);
            }
            textView2.setText(str3);
            textView3.setText(str4);
            textView2.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                    if (onResultClickListener != null) {
                        onResultClickListener.result(false);
                    }
                }
            });
            textView3.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                    if (onResultClickListener != null) {
                        onResultClickListener.result(true);
                    }
                }
            });
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
    }

    public static void showClickHandDialog(final boolean z, final Context context, String str, String str2, boolean z2, boolean z3, String str3, String str4, final OnResultClickListener onResultClickListener, boolean z4) {
        try {
            Dialog dialog2 = dialog;
            if (dialog2 != null && dialog2.isShowing()) {
                dialog.dismiss();
            }
            if (z4) {
                dialog = createSysDailog(context, R.layout.dialog_clickhand_sure);
            } else {
                dialog = createDailog(context, R.layout.dialog_clickhand_sure);
            }
            dialog.setCancelable(false);
            TextView textView = (TextView) dialog.findViewById(R.id.id_content);
            TextView textView2 = (TextView) dialog.findViewById(R.id.tv_cancel);
            TextView textView3 = (TextView) dialog.findViewById(R.id.tv_close);
            TextView textView4 = (TextView) dialog.findViewById(R.id.tv_sure);
            EditText editText = (EditText) dialog.findViewById(R.id.editText);
            editText.setText(DataUtil.getHandClickTime(MyApp.getContext()) + "");
            editText.addTextChangedListener(new TextWatcher() {
                public void afterTextChanged(Editable editable) {
                }

                public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                }

                public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    try {
                        DataUtil.setHandClickTime(MyApp.getContext(), MathUtils.parseInt(charSequence.toString()));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
            ((TextView) dialog.findViewById(R.id.tv_title)).setText(str);
            textView.setText(str2);
            if (z2) {
                textView.setTextColor(-65536);
            }
            if (z3) {
                textView.setGravity(17);
            }
            textView2.setText(str3);
            textView4.setText(str4);
            textView3.setOnClickListener(new View.OnClickListener() {
                /* class com.lmiot.xyclick.Util.LayoutDialogUtil.AnonymousClass6 */

                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                    if (!z) {
                        FloatManager.hide(InitFloatBean.FloatType.hand);
                    } else {
                        FloatManager.hide(InitFloatBean.FloatType.handPlus);
                    }
                }
            });
            textView2.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                    if (onResultClickListener != null) {
                        onResultClickListener.result(false);
                    }
                }
            });
            textView4.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                    if (onResultClickListener != null) {
                        onResultClickListener.result(true);
                    }
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void showAutoList(final Context context) {
        try {
            Dialog dialog2 = dialog;
            if (dialog2 != null && dialog2.isShowing()) {
                dialog.dismiss();
            }
            Dialog createBottomDailog = createBottomDailog(context, R.layout.dialog_show_auto_list);
            dialog = createBottomDailog;
            LinearLayout linearLayout = (LinearLayout) createBottomDailog.findViewById(R.id.id_main_layout);
            View findViewById = dialog.findViewById(R.id.id_top);
            TextView textView = (TextView) dialog.findViewById(R.id.id_cancel);
            final ImageView imageView = (ImageView) dialog.findViewById(R.id.id_list);
            ImageView imageView2 = (ImageView) dialog.findViewById(R.id.id_home);
            ImageView imageView3 = (ImageView) dialog.findViewById(R.id.id_sort_list);
            final EditText editText = (EditText) dialog.findViewById(R.id.id_search_edit);
            final ImageView imageView4 = (ImageView) dialog.findViewById(R.id.id_search_clear);
            final GridView gridView = (GridView) dialog.findViewById(R.id.id_gridview);
            if (DataUtil.getVerView(MyApp.getContext())) {
                imageView.setImageResource(R.drawable.list01);
                gridView.setNumColumns(1);
            } else {
                imageView.setImageResource(R.drawable.friend_group);
                gridView.setNumColumns(4);
            }
            if (ActionNormalSDK.getInstance().isScreenPortrait(MyApp.getContext())) {
                findViewById.setVisibility(View.VISIBLE);
            } else {
                findViewById.setVisibility(View.GONE);
            }
            linearLayout.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                }
            });
            textView.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                }
            });
            List<AutoBean> searchAll = AutoBeanSqlUtil.getInstance().searchAll();
            final ArrayList<AutoBean> arrayList = new ArrayList();
            for (AutoBean autoBean : searchAll) {
                if (DataUtil.getShowAuto(MyApp.getContext(), autoBean.getAutoID())) {
                    arrayList.add(autoBean);
                }
            }
            imageView3.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                    Intent unused = LayoutDialogUtil.intent = new Intent(MyApp.getContext(), SortAutoListActivity.class);
                    LayoutDialogUtil.intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    MyApp.getInstance().startActivity(LayoutDialogUtil.intent);
                }
            });
            DialogAutoAdapter dialogAutoAdapter2 = new DialogAutoAdapter(context, arrayList);
            dialogAutoAdapter = dialogAutoAdapter2;
            gridView.setAdapter((ListAdapter) dialogAutoAdapter2);
            imageView.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    if (DataUtil.getVerView(MyApp.getContext())) {
                        DataUtil.setVerView(MyApp.getContext(), false);
                        gridView.setNumColumns(4);
                        imageView.setImageResource(R.drawable.friend_group);
                    } else {
                        DataUtil.setVerView(MyApp.getContext(), true);
                        gridView.setNumColumns(1);
                        imageView.setImageResource(R.drawable.list01);
                    }
                    DialogAutoAdapter unused = LayoutDialogUtil.dialogAutoAdapter = new DialogAutoAdapter(context, arrayList);
                    gridView.setAdapter((ListAdapter) LayoutDialogUtil.dialogAutoAdapter);
                }
            });
            editText.addTextChangedListener(new TextWatcher() {

                public void afterTextChanged(Editable editable) {
                }

                public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                }

                public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    String unused = LayoutDialogUtil.mSearchName = charSequence.toString();
                    if (TextUtils.isEmpty(LayoutDialogUtil.mSearchName)) {
                        imageView4.setVisibility(View.GONE);
                        if (LayoutDialogUtil.dialogAutoAdapter != null) {
                            LayoutDialogUtil.dialogAutoAdapter.setData(arrayList, null);
                            return;
                        }
                        return;
                    }
                    imageView4.setVisibility(View.VISIBLE);
                    if (arrayList != null && arrayList.size() > 0) {
                        for (AutoBean autoBean : arrayList) {
                            if (autoBean.getAutoName().contains(LayoutDialogUtil.mSearchName)) {
                                arrayList.add(autoBean);
                            }
                        }
                        if (LayoutDialogUtil.dialogAutoAdapter != null) {
                            LayoutDialogUtil.dialogAutoAdapter.setData(arrayList, LayoutDialogUtil.mSearchName);
                        }
                    }
                }
            });
            imageView4.setOnClickListener(new View.OnClickListener() {

                public void onClick(View view) {
                    editText.setText("");
                }
            });
            imageView2.setOnClickListener(new View.OnClickListener() {

                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                    Intent unused = LayoutDialogUtil.intent = new Intent(MyApp.getContext(), MainActivity.class);
                    LayoutDialogUtil.intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    MyApp.getInstance().startActivity(LayoutDialogUtil.intent);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /* access modifiers changed from: private */
    public static class DialogAutoAdapter extends BaseAdapter {
        private Context mContext;
        private List<AutoBean> mList;

        public Object getItem(int i) {
            return null;
        }

        public long getItemId(int i) {
            return 0;
        }

        public DialogAutoAdapter(Context context, List<AutoBean> list) {
            this.mContext = context;
            this.mList = list;
        }

        public int getCount() {
            return this.mList.size();
        }

        public View getView(int i, View view, ViewGroup viewGroup) {
            View view2;
            if (DataUtil.getVerView(MyApp.getContext())) {
                view2 = View.inflate(MyApp.getContext(), R.layout.item_dialog_auto_ver, null);
            } else {
                view2 = View.inflate(MyApp.getContext(), R.layout.item_dialog_auto, null);
            }
            ImageView imageView = (ImageView) view2.findViewById(R.id.id_img);
            RoundedImageView roundedImageView = (RoundedImageView) view2.findViewById(R.id.auto_icon);
            TextView textView = (TextView) view2.findViewById(R.id.id_name);
            final AutoBean autoBean = this.mList.get(i);
            File file = new File(Environment.getExternalStorageDirectory() + "/XYClick/temp", autoBean.getAutoID() + ".jpg");
            if (file.exists()) {
                roundedImageView.setImageBitmap(BitmapFactory.decodeFile(file.getAbsolutePath()));
                imageView.setVisibility(View.GONE);
                roundedImageView.setVisibility(View.VISIBLE);
            } else {
                imageView.setVisibility(View.VISIBLE);
                roundedImageView.setVisibility(View.GONE);
                Glide.with(this.mContext).load(Integer.valueOf((int) R.drawable.play_auto_blue)).into(roundedImageView);
            }
            String autoName = autoBean.getAutoName();
            if (TextUtils.isEmpty(LayoutDialogUtil.mSearchName)) {
                textView.setText(autoName);
            } else {
                textView.setText(Html.fromHtml(autoName.replace(LayoutDialogUtil.mSearchName, "<font color='#FF0000'>" + LayoutDialogUtil.mSearchName + "</font>")));
            }
            autoBean.getRepeatNum();
            view2.setOnClickListener(new View.OnClickListener() {
                /* class com.lmiot.xyclick.Util.LayoutDialogUtil.DialogAutoAdapter.AnonymousClass1 */

                public void onClick(View view) {
                    LayoutDialogUtil.dialog.dismiss();
                    LayoutDialogUtil.executeAuto(autoBean);
                }
            });
            view2.setOnLongClickListener(new View.OnLongClickListener() {
                public boolean onLongClick(View view) {
                    LayoutDialogUtil.dialog.dismiss();
                    ArrayList arrayList = new ArrayList();
                    arrayList.add(new EditDialogUtil.MenuBean(R.drawable.edit_time, "编辑自动化", null));
                    arrayList.add(new EditDialogUtil.MenuBean(R.drawable.auto_time, "指定运行时长", null));
                    arrayList.add(new EditDialogUtil.MenuBean(R.drawable.recycle_num, "从第几次循环开始", null));
                    arrayList.add(new EditDialogUtil.MenuBean(R.drawable.insert, "从第几个动作开始", null));
                    EditDialogUtil.getInstance().buttomMenuDialog(MyApp.getContext(), 8, arrayList, new EditDialogUtil.OnMenuClickListener() {
                        @Override // com.lmiot.xyclick.Util.EditDialogUtil.OnMenuClickListener
                        public void click(int i) {
                            if (i != 0) {
                                if (i == 1) {
                                    LayoutDialogUtil.doAutoByTime(autoBean);
                                } else if (i == 2) {
                                    final int repeatNum = autoBean.getRepeatNum();
                                    if (repeatNum == 0 || repeatNum == 1) {
                                        ToastUtil.warning("执行次数必须大于1");
                                        return;
                                    }
                                    String str = "1～" + repeatNum;
                                    if (repeatNum == -1) {
                                        str = "1～99999";
                                    }
                                    EditDialogUtil.getInstance().edit(MyApp.getContext(), 8194, "请输入从第几次循环开始执行", str, "", new EditDialogUtil.EditMethod() {
                                        @Override // com.lmiot.xyclick.Util.EditDialogUtil.EditMethod
                                        public void edit(String str) {
                                            try {
                                                int parseInt = MathUtils.parseInt(str) - 1;
                                                int i = repeatNum;
                                                if (i != -1) {
                                                    if (parseInt >= i) {
                                                        parseInt = i;
                                                    }
                                                    if (parseInt <= 0) {
                                                        parseInt = 0;
                                                    }
                                                }
                                                EventBus.getDefault().post(new DoAutoBean(107, autoBean, null, parseInt));
                                            } catch (Exception e) {
                                                e.printStackTrace();
                                            }
                                        }
                                    }, true);
                                } else if (i == 3) {
                                    final int size = ActionBeanSqlUtil.getInstance().searchByID(autoBean.getAutoID()).size();
                                    if (size <= 1) {
                                        ToastUtil.warning("动作数量必须大于1");
                                        return;
                                    }
                                    EditDialogUtil.getInstance().edit(MyApp.getContext(), 8194, "请输入从第几个动作开始执行", "0～" + size, "", new EditDialogUtil.EditMethod() {

                                        @Override // com.lmiot.xyclick.Util.EditDialogUtil.EditMethod
                                        public void edit(String str) {
                                            try {
                                                int parseInt = MathUtils.parseInt(str);
                                                int i = size;
                                                if (parseInt >= i) {
                                                    parseInt = i;
                                                }
                                                if (parseInt <= 0) {
                                                    parseInt = 0;
                                                }
                                                EventBus.getDefault().post(new DoAutoBean(108, autoBean, null, parseInt));
                                            } catch (Exception e) {
                                                e.printStackTrace();
                                            }
                                        }
                                    }, true);
                                }
                            } else if (AutoUtils.canEdit(autoBean)) {
                                AutoUtils.editAuto(DialogAutoAdapter.this.mContext, autoBean);
                            } else {
                                ClickUtils.onlyVibrate(DialogAutoAdapter.this.mContext);
                                EditDialogUtil.getInstance().edit(DialogAutoAdapter.this.mContext, 1, "该自动化已加密，请输入密码", "请输入密码", "", new EditDialogUtil.EditMethod() {
                                    @Override // com.lmiot.xyclick.Util.EditDialogUtil.EditMethod
                                    public void edit(String str) {
                                        if (FileUtils.decodeString(autoBean.getPassword()).equals(str)) {
                                            AutoUtils.editAuto(DialogAutoAdapter.this.mContext, autoBean);
                                        } else {
                                            ToastUtil.err("密码不正确！");
                                        }
                                    }
                                }, false);
                            }
                        }
                    }, true, false);
                    return true;
                }
            });
            return view2;
        }

        public void setData(List<AutoBean> list, String str) {
            this.mList = list;
            String unused = LayoutDialogUtil.mSearchName = str;
            notifyDataSetChanged();
        }
    }

    public static void showTrackDialog(final Context context, final String str, String str2, String str3, boolean z, boolean z2, String str4, String str5, final OnResultClickListener onResultClickListener, boolean z3) {
        try {
            Dialog dialog2 = dialog;
            if (dialog2 != null && dialog2.isShowing()) {
                dialog.dismiss();
            }
            if (z3) {
                dialog = createSysDailog(context, R.layout.dialog_trackclick_sure);
            } else {
                dialog = createDailog(context, R.layout.dialog_trackclick_sure);
            }
            dialog.setCancelable(false);
            TextView textView = (TextView) dialog.findViewById(R.id.id_content);
            TextView textView2 = (TextView) dialog.findViewById(R.id.tv_cancel);
            TextView textView3 = (TextView) dialog.findViewById(R.id.tv_close);
            TextView textView4 = (TextView) dialog.findViewById(R.id.tv_sure);
            EditText editText = (EditText) dialog.findViewById(R.id.editText);
            editText.setText(DataUtil.getTrackClick(MyApp.getContext()) + "");
            editText.addTextChangedListener(new TextWatcher() {
                public void afterTextChanged(Editable editable) {
                }

                public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                }

                public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    try {
                        int parseInt = MathUtils.parseInt(charSequence.toString());
                        if (parseInt >= 100) {
                            parseInt = 100;
                        }
                        if (parseInt <= 0) {
                            parseInt = 0;
                        }
                        DataUtil.setTrackClick(MyApp.getContext(), parseInt);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
            Glide.with(MyApp.getContext()).load(str).apply(new RequestOptions().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).fitCenter()).into((ImageView) dialog.findViewById(R.id.id_img));
            ((TextView) dialog.findViewById(R.id.id_edit)).setOnClickListener(new View.OnClickListener() {
                /* class com.lmiot.xyclick.Util.LayoutDialogUtil.AnonymousClass17 */

                public void onClick(View view) {
                    LayoutDialogUtil.dialog.dismiss();
                    ArrayList arrayList = new ArrayList();
                    arrayList.add(new EditDialogUtil.MenuBean(R.drawable.edit_time, "直接编辑", null));
                    arrayList.add(new EditDialogUtil.MenuBean(R.drawable.icon_shortcut, "选择相片", null));
                    EditDialogUtil.getInstance().buttomMenuDialog(MyApp.getContext(), 4, arrayList, new EditDialogUtil.OnMenuClickListener() {
                        @Override
                        public void click(int i) {
                            EventBus.getDefault().post(new FinishFloatActivityBean(true));
                            if (i == 0) {
                                YYCutSDK.getInstance(MyApp.getContext()).cut(str, true, YYCutSDK.CutShape.Rect, new YYCutSDK.OnYYCutListener() {
                                    @Override // com.youyi.yycutsdklibrary.SDK.YYCutSDK.OnYYCutListener
                                    public void result(boolean z, String str, Bitmap bitmap) {
                                        if (z) {
                                            ImgUtil.saveBitmpToFile(bitmap, new File(str));
                                        }
                                    }
                                });
                            } else if (i == 1) {
                                YYChoseSDK.getInstance(MyApp.getContext()).chosePic(false, 1, new YYChoseSDK.OnSelectListener() {
                                    @Override
                                    public void onCancel() {
                                    }

                                    @Override
                                    public void onResult(ArrayList<Photo> arrayList, boolean z) {
                                        YYCutSDK.getInstance(MyApp.getContext()).cut(arrayList.get(0).path, true, YYCutSDK.CutShape.Oval, new YYCutSDK.OnYYCutListener() {
                                            @Override
                                            public void result(boolean z, String str, Bitmap bitmap) {
                                                if (z) {
                                                    ImgUtil.saveBitmpToFile(bitmap, new File(str));
                                                }
                                            }
                                        });
                                    }
                                });
                            }
                        }
                    }, true, false);
                }
            });
            ((TextView) dialog.findViewById(R.id.tv_title)).setText(str2);
            textView.setText(str3);
            if (z) {
                textView.setTextColor(-65536);
            }
            if (z2) {
                textView.setGravity(17);
            }
            textView2.setText(str4);
            textView4.setText(str5);
            textView3.setOnClickListener(new View.OnClickListener() {

                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                    FloatManager.hide(InitFloatBean.FloatType.track);
                }
            });
            textView2.setOnClickListener(new View.OnClickListener() {

                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                    if (onResultClickListener != null) {
                        onResultClickListener.result(false);
                    }
                }
            });
            textView4.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    ClickUtils.onlyVibrate(context);
                    LayoutDialogUtil.dialog.dismiss();
                    if (onResultClickListener != null) {
                        onResultClickListener.result(true);
                    }
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void doAutoByTime(final AutoBean autoBean) {
        try {
            final Dialog createSysDailog = createSysDailog(MyApp.getContext(), R.layout.dialog_runtime_layout);
            setNunList((TextConfigNumberPicker) createSysDailog.findViewById(R.id.id_picker_hour), 0);
            setNunList((TextConfigNumberPicker) createSysDailog.findViewById(R.id.id_picker_min), 1);
            setNunList((TextConfigNumberPicker) createSysDailog.findViewById(R.id.id_picker_second), 2);
            ((TextView) createSysDailog.findViewById(R.id.tv_cancel)).setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    createSysDailog.dismiss();
                }
            });
            ((TextView) createSysDailog.findViewById(R.id.tv_sure)).setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    int parseInt = MathUtils.parseInt(LayoutDialogUtil.typeList02[LayoutDialogUtil.mHours_01]);
                    int parseInt2 = MathUtils.parseInt(LayoutDialogUtil.typeList01[LayoutDialogUtil.mMinute_01]);
                    int parseInt3 = MathUtils.parseInt(LayoutDialogUtil.typeList01[LayoutDialogUtil.mSecond_01]);
                    createSysDailog.dismiss();
                    EventBus.getDefault().post(new DelayEndTime(parseInt, parseInt2, parseInt3));
                    LayoutDialogUtil.executeAuto(autoBean);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void executeAuto(AutoBean autoBean) {
        if (!AutoUtils.hasAs(autoBean)) {
            EventBus.getDefault().post(new DoAutoBean(101, autoBean, null, 0));
        } else if (ActionAsSDK.getInstance().checkAs(MyApp.getContext())) {
            EventBus.getDefault().post(new DoAutoBean(101, autoBean, null, 0));
        } else {
            try {
                ToastUtil.warning(MyApp.getInstance().getString(R.string.optf));
                intent = new Intent("android.settings.ACCESSIBILITY_SETTINGS");
                MyApp.getInstance().startActivity(intent);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    private static void setNunList(TextConfigNumberPicker textConfigNumberPicker, final int i) {
        if (i == 0) {
            textConfigNumberPicker.setMaxValue(typeList02.length - 1);
            textConfigNumberPicker.setDisplayedValues(typeList02);
            textConfigNumberPicker.setValue(mHours_01);
        } else if (i == 1) {
            textConfigNumberPicker.setMaxValue(typeList01.length - 1);
            textConfigNumberPicker.setDisplayedValues(typeList01);
            textConfigNumberPicker.setValue(mMinute_01);
        } else if (i == 2) {
            textConfigNumberPicker.setMaxValue(typeList01.length - 1);
            textConfigNumberPicker.setDisplayedValues(typeList01);
            textConfigNumberPicker.setValue(mSecond_01);
        }
        textConfigNumberPicker.setMinValue(0);
        textConfigNumberPicker.setWrapSelectorWheel(false);
        textConfigNumberPicker.setDescendantFocusability(393216);
        textConfigNumberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {

            public void onValueChange(NumberPicker numberPicker, int i, int i2) {
                int i3 = i;
                if (i3 == 0) {
                    int unused = LayoutDialogUtil.mHours_01 = i2;
                } else if (i3 == 1) {
                    int unused2 = LayoutDialogUtil.mMinute_01 = i2;
                } else if (i3 == 2) {
                    int unused3 = LayoutDialogUtil.mSecond_01 = i2;
                }
            }
        });
    }

    public static void checkVIP(final Context context) {
        try {
            if (context instanceof Activity) {
                Dialog dialog2 = dialog;
                if (dialog2 != null && dialog2.isShowing()) {
                    dialog.dismiss();
                }
                Dialog createBottomDailog = createBottomDailog(context, R.layout.dialog_ask_vip);
                dialog = createBottomDailog;
                createBottomDailog.setCancelable(true);
                ((TextView) dialog.findViewById(R.id.bt_vip)).setOnClickListener(new View.OnClickListener() {
                    public void onClick(View view) {
                        LayoutDialogUtil.dialog.dismiss();
                        if (!MyApp.getInstance().checkLogin(context)) {
                            Intent intent = new Intent(MyApp.getContext(), PayVIPActivity.class);
                            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            MyApp.getContext().startActivity(intent);
                        }
                    }
                });
                return;
            }
            ToastUtil.warning(MyApp.getContext().getString(R.string.mb12));
        } catch (Exception e) {
            e.printStackTrace();
            ToastUtil.warning(MyApp.getContext().getString(R.string.mb12));
        }
    }
}
